package com.dmp.onlinestore.model.service;

import java.util.List;

import com.dmp.onlinestore.model.dto.ProductBean;

public interface ProductBeanPager {

	// Returns the size of the managed list. Useful for
	// testing and such.
	public int getManagedListSize();
	
	// Pages down by one page, or a partial page if fewer than
	// "pageSize" products remain after the current page. If no
	// paging has yet been done, then the first page is returned.
    // If the list of elements this pager is managing is zero,
	// then an empty list is returned.
	public List<ProductBean> pageDown();
	
	// Positions the pager on the given page number. Page numbers are 
	// 1-based (first available page is page 1) as this
	// is what general users are familiar with.
	// If the given page number is greater than the number
	// of pages available, then the pager is positioned on the last page.
	// If the managed list is empty, or the requested page number is
	// less than 1, then the current page is returned. For an 
	// empty managed list, this means an empty list is returned.
	public List<ProductBean> goToPage(int pageNum);
	
	// Returns true if there is at least one complete or partial
	// page following the current page.
	public boolean hasMoreDownPages();
	
	// Returns true if there is at least one complete or partial
	// page following the current page.
	public boolean hasMoreUpPages();
	
	// Pages up by one page. If there are fewer than "pageSize()"
	// elements preceding the current page, then the returned page
	// contains the entries preceding this page, plus the first part
	// of the current page, making a complete page. Ie., the first
	// group of entries on the current page will appear at the end
	// of the newly displayed page. 
	// 
	// If no page has yet been displayed, then an empty list is
	// returned. If the current page is the first page in the list, then
	// this page is returned.
	public List<ProductBean> pageUp();
	
	// Returns the current page size.
	public int getPageSize();
	
	// Set the current page size. Returns the current page based on
	// this new page size. Contract is that the invoker will re-display
	// or otherwise process this new/updated page in order that no data 
	// is missed on a future pageDown().
	public List<ProductBean> setPageSize(int pageSize);

	// Returns the current page (does not advance in either direction).
	public List<ProductBean> getCurrentPage();
	
	// Returns a list of strings of indices.
	public List<String> getPageIndices();
	
	// Get current page range.
	public String getCurrentPageRange();
	
}
